package com.sijiao.reconciliation.service.impl;

import com.sijiao.reconciliation.service.IReconciliationService;
import com.sijiao.reconciliation.service.IStockCacheService;
import com.sijiao.reconciliation.service.IStockFlowService;
import org.springframework.stereotype.Service;

import java.util.LinkedList;
import java.util.List;

@Service
public class ReconciliationServiceImpl implements IReconciliationService {

    private final IStockFlowService stockFlowService;
    private final IStockCacheService stockCacheService;

    public ReconciliationServiceImpl(IStockFlowService stockFlowService, IStockCacheService stockCacheService) {
        this.stockFlowService = stockFlowService;
        this.stockCacheService = stockCacheService;
    }

    @Override
    public void reconciliation() {
        List<Long> skuIds=new LinkedList<>();
        for (Long skuId : skuIds) {
            Long stockCache = stockCacheService.getStockCache(skuId);
            Long stock = stockFlowService.getStock(skuId);
            if(stockCache.longValue()!=stock){
                System.out.println("report stock check failed !");
            }
        }
    }
}
